import Link from "next/link";
import type { ReactNode } from "react";
import { api } from "@/lib/api";
export const dynamic = "force-dynamic";
/**
* The repo shell. Navigation lives in the rail (see `JacShell`), so this
* layout only establishes the page frame and fails legibly when the repo is
* gone — which, with in-memory stores, is a normal thing to happen.
*/
export default async function RepoLayout({
children,
params,
}: {
children: ReactNode;
params: Promise<{ repo: string }>;
}) {
const { repo } = await params;
try {
await api.repo(repo);
} catch {
return (
<div className="jac-page">
<div className="jac-empty">
No repo named <span className="jac-mono">{repo}</span> — it may have
lived in a previous process. Nothing persists, honestly.{" "}
<span>
<Link href="/new">Warp a new loom</Link> or{" "}
<Link href="/">go back</Link>.
</span>
</div>
</div>
);
}
return <div className="jac-page jac-page--wide">{children}</div>;
}